<template>
  <div class="app-container">
    <div class="nav-tabs">
      <button
        @click="currentView = 'tutorial'"
        :class="{ active: currentView === 'tutorial' }"
        class="nav-btn"
      >
        📚 响应式教程
      </button>
      <button
        @click="currentView = 'snake'"
        :class="{ active: currentView === 'snake' }"
        class="nav-btn"
      >
        🎮 贪吃蛇游戏
      </button>
    </div>

    <div class="content-area">
      <ReactiveBasics v-if="currentView === 'tutorial'" />
      <SnakeGame v-else-if="currentView === 'snake'" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import ReactiveBasics from '@/components/ReactiveBasics.vue'
import SnakeGame from '@/components/SnakeGame.vue'

const currentView = ref('tutorial')
</script>

<style scoped>
.app-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.nav-tabs {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.nav-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid transparent;
  color: white;
  padding: 12px 24px;
  margin: 0 10px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: bold;
  transition: all 0.3s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.nav-btn.active {
  background: white;
  color: #667eea;
  border-color: white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.content-area {
  padding: 20px;
  min-height: calc(100vh - 80px);
}
</style>
